<button type="button" data-controller="dropdown" data-target="actions-conference-<%= conference.id %>" aria-label="<%= t("decidim.admin.actions.actions_label", resource: translated_attribute(conference.title)) %>">
  <%= icon "more-fill", class: "text-secondary" %>
</button>

<div class="inline-block relative">
  <ul id="actions-conference-<%= conference.id %>" class="dropdown dropdown__action" aria-hidden="true">
    <% if view == :deleted %>
      <% if allowed_to? :restore, :conference, trashable_deleted_resource: conference %>
        <li class="dropdown__item">
          <%= link_to restore_conference_path(conference), class: "dropdown__button", method: :patch do %>
            <%= icon "refresh-line" %>
            <%= t("decidim.admin.actions.restore") %>
          <% end %>
        </li>
      <% end %>
    <% else %>
      <% if allowed_to? :update, :conference, conference: conference %>
        <li class="dropdown__item">
          <%= link_to edit_conference_path(conference), class: "dropdown__button" do %>
            <%= icon "pencil-line" %>
            <%= t("decidim.admin.actions.edit") %>
          <% end %>
        </li>

        <hr>
      <% end %>

      <% if allowed_to? :create, :conference, conference: conference %>
        <li class="dropdown__item">
          <%= link_to new_conference_duplicate_path(conference), class: "dropdown__button" do %>
            <%= icon "file-copy-line" %>
            <%= t("decidim.admin.actions.duplicate") %>
          <% end %>
        </li>

        <hr>
      <% end %>

      <% if allowed_to? :preview, :conference, conference: conference %>
        <li class="dropdown__item">
          <%= link_to decidim_conferences.conference_path(conference, locale: current_locale), class: "dropdown__button", target: "_blank", data: { "external-link": false } do %>
            <%= icon "eye-line" %>
            <%= t("decidim.admin.actions.preview") %>
          <% end %>
        </li>
      <% end %>

      <% if allowed_to? :publish, :conference, conference: conference %>
        <li class="dropdown__item">
          <% if conference.published? %>
            <%= link_to conference_publish_path(conference), method: :delete, class: "dropdown__button" do %>
              <%= icon "close-circle-line" %>
              <%= t("actions.unpublish", scope: "decidim.admin") %>
            <% end %>
          <% else %>
            <%= link_to conference_publish_path(conference), method: :post, class: "dropdown__button" do %>
              <%= icon "check-line" %>
              <%= t("actions.publish", scope: "decidim.admin") %>
            <% end %>
          <% end %>
        </li>
      <% end %>

      <hr>
      <% if allowed_to? :read, :share_token, current_participatory_space: conference %>
        <li class="dropdown__item">
          <%= link_to decidim_admin_conferences.conference_share_tokens_path(conference), class: "dropdown__button" do %>
            <%= icon "share-line" %>
            <%= t("actions.share_tokens", scope: "decidim.admin") %>
          <% end %>
        </li>

        <hr>
      <% end %>

      <% if allowed_to? :read, :moderation, conference: conference %>
        <li class="dropdown__item">
          <%= link_to moderations_path(conference), class: "dropdown__button" do %>
            <%= icon "flag-line" %>
            <%= t("decidim.admin.actions.moderate") %>
          <% end %>
        </li>

        <hr>
      <% end %>

      <% if allowed_to? :soft_delete, :conference, trashable_deleted_resource: conference %>
        <% if conference.published? %>
          <li class="dropdown__item">
            <div class="dropdown__button-disabled">
              <%= with_tooltip t("tooltips.deleted_conferences_info", scope: "decidim.admin") do %>
                <%= icon "delete-bin-line", class: "text-gray" %>
                <span>
                  <%= t("decidim.admin.actions.soft_delete") %>
                </span>
              <% end %>
            </div>
          </li>
        <% else %>
          <li class="dropdown__item">
            <%= link_to soft_delete_conference_path(conference), class: "dropdown__button", method: :patch, data: { confirm: t("decidim.admin.actions.confirm_delete_conference") } do %>
              <%= icon "delete-bin-line" %>
              <%= t("decidim.admin.actions.soft_delete") %>
            <% end %>
          </li>
        <% end %>
      <% end %>
    <% end %>
  </ul>
</div>
